<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>嵌套if语句</title>
	</head>
	<body>
		<script>
			var username = prompt("请您输入用户名");
			
			if(username == "汪静"){
				var userpwd = prompt("请您输入用户密码");
				if(userpwd == "123"){
					document.write("登录成功");
				}
				else{
					document.write("您输入的密码错误！");
				}
			}
			else{
				document.write("您输入的用户名错误！")
			}
		</script>
	</body>
</html>